package com.mk.wardsystemserver.controller;


import com.mk.wardsystemserver.pojo.Medicine;
import com.mk.wardsystemserver.pojo.RespBean;
import com.mk.wardsystemserver.pojo.RespPageBean;
import com.mk.wardsystemserver.service.IMedicineService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zhoubin
 * @since 2022-03-24
 */
@RestController
@RequestMapping("/medicine")
public class MedicineController {
    @Autowired
    private IMedicineService medicineService;

    @ApiOperation(value="获取所有药物信息")
    @GetMapping("/")
    public RespPageBean getMedicine(@RequestParam(defaultValue = "1") Integer pageCurrent,
                                    @RequestParam(defaultValue = "10") Integer pageSize,
                                    Medicine medicine){
        return medicineService.getMedicineByPage(pageCurrent,pageSize,medicine);
    }

    @ApiOperation(value = "获取药品id和名称")
    @GetMapping("/name")
    public List<Medicine> getName(){
        return medicineService.getMedicineName();
    }
}
